library IEEE;
use IEEE.STD_LOGIC_1164.all;

package CONSTANTS is
	constant DATA_SIZE		: integer := 32;	-- Data size
	constant ADDR_SIZE		: integer := 13;	-- Address size
	constant N_GW			: integer := 3;		-- Number of gateways on the platform
	constant STATUS_SIZE	: integer := 4;
	constant DATA_SIZE_IJTAG   : integer:= 3; -- Data size of the register internal to the IJTAG components
	constant ADDR_SIZE_CONFBUFFER : integer := 4; -- Size of the configuration buffer
	constant ADDR_SIZE_RESBUFFER  : integer := 4;         -- Size of the results buffer
	-- Status register value
	
	-- to be extended to 32 bit
	constant STATUS_IDLE								: std_logic_vector(STATUS_SIZE-1 downto 0) := "0000";
	constant STATUS_GW_CONFIG						: std_logic_vector(STATUS_SIZE-1 downto 0) := "0001";
	constant STATUS_GW_SHIFT						: std_logic_vector(STATUS_SIZE-1 downto 0) := "0010";
	constant STATUS_GW_UPDATE						: std_logic_vector(STATUS_SIZE-1 downto 0) := "0011";
	constant STATUS_MON_LOAD_VALUE				: std_logic_vector(STATUS_SIZE-1 downto 0) := "0100";
	constant STATUS_MON_CAPTURE					: std_logic_vector(STATUS_SIZE-1 downto 0) := "0101";
	constant STATUS_MON_SHIFT						: std_logic_vector(STATUS_SIZE-1 downto 0) := "0110";
	constant STATUS_MON_UPDATE						: std_logic_vector(STATUS_SIZE-1 downto 0) := "0111";
	constant STATUS_LOAD_CONFIG_STORE_RESULT	: std_logic_vector(STATUS_SIZE-1 downto 0) := "1000";
	constant STATUS_GW_PASSIVE						: std_logic_vector(STATUS_SIZE-1 downto 0) := "1001";
	constant STATUS_IRQ								: std_logic_vector(STATUS_SIZE-1 downto 0) := "1010";
	
	-- registers address
	constant STATUS_ADDR		: integer := 0;
	constant CMD_ADDR			: integer := 1;
	constant IRQ_ADDR			: integer := 2;
	constant SCAN_PERIOD_ADDR	: integer := 3;
	constant MON_LEN_ADDR		: integer := 4;
	constant CONFIG_BUFFER_BASE_ADDR	: integer := 5;
	constant RESULT_BUFFER_BASE_ADDR	: integer := 9;
	
	-- Command Register's Value
	constant CMD_NOP	: std_logic_vector(DATA_SIZE-1 downto 0) := X"00000000";
	constant CMD_START	: std_logic_vector(DATA_SIZE-1 downto 0) := X"00000001";
	constant CMD_STOP	: std_logic_vector(DATA_SIZE-1 downto 0) := X"00000002";
	constant CMD_RESET	: std_logic_vector(DATA_SIZE-1 downto 0) := X"00000004";
	constant CMD_MON_LEN	: std_logic_vector(DATA_SIZE-1 downto 0) := X"00000005";
	
end CONSTANTS;
